generic damage generation for offscreen windows
authorMatthias Clasen <mclasen@redhat.com>
Wed, 4 Aug 2010 22:43:53 +0000 (18:43 -0400)
committerBenjamin Otte <otte@redhat.com>
Tue, 10 Aug 2010 19:02:30 +0000 (21:02 +0200)
Generating damage from gdk drawing api doesn't help for cairo rendering
...and the gdk drawing api is gone anyway. Bug 621571

gdk/gdkoffscreenwindow.c
gdk/gdkwindow.c

index c8fc4187aec4b5ea60546ef366dadde66886ec54..2c808083e604fe7a565fe300a5ed2218752d6fdc 100644 (file)
@@ -209,45 +209,6 @@ gdk_offscreen_window_get_visual (GdkDrawable    *drawable)
   return gdk_drawable_get_visual (offscreen->wrapper);
 }
 
-static void
-add_damage (GdkOffscreenWindow *offscreen,
-           int x, int y,
-           int w, int h,
-           gboolean is_line)
-{
-  GdkRectangle rect;
-  cairo_region_t *damage;
-
-  rect.x = x;
-  rect.y = y;
-  rect.width = w;
-  rect.height = h;
-
-  if (is_line)
-    {
-      /* This should really take into account line width, line
-       * joins (and miter) and line caps. But these are hard
-       * to compute, rarely used and generally a pain. And in
-       * the end a snug damage rectangle is not that important
-       * as multiple damages are generally created anyway.
-       *
-       * So, we just add some padding around the rect.
-       * We use a padding of 3 pixels, plus an extra row
-       * below and on the right for the normal line size. I.E.
-       * line from (0,0) to (2,0) gets h=0 but is really
-       * at least one pixel tall.
-       */
-      rect.x -= 3;
-      rect.y -= 3;
-      rect.width += 7;
-      rect.height += 7;
-    }
-
-  damage = cairo_region_create_rectangle (&rect);
-  _gdk_window_add_damage (offscreen->wrapper, damage);
-  cairo_region_destroy (damage);
-}
-
 void
 _gdk_offscreen_window_new (GdkWindow     *window,
                           GdkScreen     *screen,
index f39d2ca35eb10f844a8e185da5287f00abee0a1a..81f3ab331b785a2e551cd8ba3956ee77233df1a6 100644 (file)
@@ -4305,6 +4305,10 @@ _gdk_window_process_updates_recurse (GdkWindow *window,
   if (cairo_region_is_empty (expose_region))
     return;
 
+  if (gdk_window_is_offscreen (private->impl_window) &&
+      private == private->impl_window)
+    _gdk_window_add_damage ((GdkWindow *) private->impl_window, expose_region);
+
   /* Make this reentrancy safe for expose handlers freeing windows */
   children = g_list_copy (private->children);
   g_list_foreach (children, (GFunc)g_object_ref, NULL);